package com.tan.simpleweather.base

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

/**

@author： TanJun
@date： 2021/11/15 17:02
@description： TODO
@modifiedBy：
@version: 1.0
 */
@Database(entities = [PlaceBean::class],version = 1, exportSchema = false)
abstract class AppDataBase: RoomDatabase() {

    abstract fun getPlace():PlaceDao

    companion object{
        private var instance: AppDataBase ?= null

        @Synchronized
        fun getDataBase(context:Context):AppDataBase{
            return instance ?:Room.databaseBuilder(
                context,
                AppDataBase::class.java,
                "app_database").build()
        }
    }

}